package com.sishu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sishu.pojo.Questionlibrary;
import com.sishu.pojo.VO.QuestionlibraryVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface QuestionlibraryMapper extends BaseMapper<Questionlibrary> {


    // 查询所有题目表
    @Select("select * from questionlibrary")
    List<Questionlibrary> selcetAll();

    // 根据题目分类查询题目
    @Select("select * from questionlibrary where classification = #{classification}")
    List<Questionlibrary> selcetbyclassification(String classification);

    // 根据题目id查询题目
    @Select("select * from questionlibrary where question_id = #{questionId}")
    Questionlibrary selectbyquestionid(Integer questionId);

//    @Select("select * from questionlibrary where classification = #{classification} and ( class_hour <= #{classHour} or class_hour is null)")
//    List<Questionlibrary> selcetbyclassificationbyclasshour(Integer classHour, String classification);

    @Select("select * from questionlibrary where classification = #{classification} and class_hour <= #{classHour}")
    List<Questionlibrary> selcetbyclassificationbyclasshour(Integer classHour, String classification);

    @Select("select * from questionlibrary where class_hour = #{classHour}")
    List<QuestionlibraryVo> selcetbyclasshour(Integer classHour);

}
